<?php


namespace Modules\User\Http\Controllers\Web;


use App\Http\Controllers\MyController;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Modules\User\Models\User;
use App\Models\UserInfo;
use Addons\School\Models\School;
use Modules\User\Models\UserPoint;
use Modules\Cms\Models\ArticleMeta;
use Modules\User\Http\Requests\UserInfoRequest;
class TaskController extends MyController
{
    public function index($aid)
    {
        session([
            'the_page' => 'taskindex',
            'page_title' => "获取积分",
        ]);
        $uid= auth()->user()->id;
        $point=UserPoint::where('user_id', $uid)->where('aid',$aid)->sum('point')?:0;
        $share_point=ArticleMeta::where('article_id',$aid)->where('meta_key','share_point')->value('meta_value')?:0;
        $sign_point=ArticleMeta::where('article_id',$aid)->where('meta_key','sign_point')->value('meta_value')?:0;     
        return $this->theme('taskindex',['point'=>$point,'aid'=>$aid,'share_point'=>$share_point,'sign_point'=>$sign_point]);
    }
    public function save(UserInfoRequest $request)
    {
        
        
      
    }
}